/**
 * Copyright (C) 2025 pony working team
 * SPDX-License-Identifier: MulanPSL-2.0
 */

/* includes (local) ----------------------------------------------------------*/
#include <hal_gpio.h>
/* includes (standard library, system) ---------------------------------------*/
/* includes (other library) --------------------------------------------------*/
/* includes (project) --------------------------------------------------------*/
#include <x_compiler.h>
#include <x_errno.h>

/* defines -------------------------------------------------------------------*/
/* typedefs ------------------------------------------------------------------*/
/* macro ---------------------------------------------------------------------*/
/* variables (extern) --------------------------------------------------------*/
/* variables (local) ---------------------------------------------------------*/
/* variables (global) --------------------------------------------------------*/
/* inlines -------------------------------------------------------------------*/
/* functions -----------------------------------------------------------------*/

__weak int hal_gpio_init(hal_gpio_t *gpio)
{
    return -ENOSYS;
}

__weak int hal_gpio_write(hal_gpio_t *gpio, uint8_t data)
{
    return -ENOSYS;
}

__weak int hal_gpio_read(hal_gpio_t *gpio, uint8_t *data)
{
    return -ENOSYS;
}

__weak int hal_gpio_toggle(hal_gpio_t *gpio)
{
    return -ENOSYS;
}

__weak int hal_gpio_irq(hal_gpio_t *gpio, uint8_t enable)
{
    return -ENOSYS;
}

__weak void hal_gpio_it_handler(hal_gpio_t *gpio)
{
}

uint8_t hal_gpio_state(hal_gpio_t *gpio)
{
    uint8_t state = 0;
    hal_gpio_read(gpio, &state);
    return state;
}
